package com.jxm.a12_1;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

/**
 * @Author: jxm
 * @Description: 测试
 * @Date: 2024-1-11 16:29
 * @Version: 1.0
 */
public class Client {

    public static void main(String[] args) {
        $Proxy0 proxy = new $Proxy0(new InvocationHandler() {

            @Override
            public Object invoke(Object proxy,Method method, Object[] args) throws InvocationTargetException, IllegalAccessException {
                System.out.println("before------");
                //执行目标方法
                Object invoke = method.invoke(new Target(), args);
                System.out.println("after------");
                return invoke;
            }
        });
        proxy.food();
        System.out.println(proxy.bar());
    }
}
